package com.example.docmanagement.repository;

import com.example.docmanagement.entity.Role;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.Optional;

/**
 * 角色数据访问层
 */
@Repository
public interface RoleRepository extends JpaRepository<Role, Long>, JpaSpecificationExecutor<Role> {

    /**
     * 根据角色名称查询
     */
    Optional<Role> findByName(String name);

    /**
     * 检查角色名称是否已存在
     */
    boolean existsByName(String name);
}


